package com.freetek.mvptest.Presenter;

import com.freetek.mvptest.Model.Model;
import com.freetek.mvptest.View.IView;
import com.freetek.mvptest.Model.IModel;

/**
 * Created by Chenkai on 2017/7/26.
 */

public class Presenter implements IPresenter {
    private IView view;   //6 拥有View与Model
    private IModel model;
    public Presenter(IView view){
        this.view=view;
        model=new Model();
    }
    @Override
    public void onCreate() {

    }

    @Override
    public void performOnClick() {
        model.getData(new IModel.ICallback() {
            @Override
            public void onResult(String data) {
                String dataFromPresenter=data+" from presenter"; //8 加工数据
                view.setData(dataFromPresenter);
            }
        });
    }
}
